package com.commonlover.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.commonlover.mapper.UserMapper;
import com.commonlover.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.LinkedHashMap;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public JSONObject findUserDetailById(Integer id) {
        HashMap<String, Object> user = userMapper.findUserDetailById(id);
//        System.out.println(user);
        JSONObject jsonObject = new JSONObject(user);
//        jsonObject.put("id", user.getId());
//        jsonObject.put("nickName", user.getNickName());
//        jsonObject.put("headPortraitUrl", user.getHeadPortrait());
//        jsonObject.put("personalProfile", user.getPersonalProfile());
        return jsonObject;
    }

}
